/// @tags: DP on Tree
#include <cstdio>
#include <cstring>
#include <iostream>

using std::cin;
using std::cout;

namespace BlueQuantum {

typedef long long LL;

constexpr int MAXN = 1e2 + 5, P = 1e9 + 7;

int n;
int siz[MAXN];
int C[MAXN][MAXN], f[MAXN][MAXN], g[MAXN][MAXN];
char s[MAXN];

inline int inc(int x, int y) {
  x += y;
  return x >= P ? x - P : x;
}

inline void dfs(int u) {
  siz[u] = 1, f[u][1] = 1;
  for (int p = 0; p < 2; ++p) {
    int v = u * 2 + p;
    if (v > n) break;
    dfs(v);
    for (int i = 1; i <= siz[u]; ++i) g[u][i] = f[u][i];
    memset(f[u], 0, sizeof(f[u]));
    for (int i = siz[u]; i >= 1; --i)
      for (int j = siz[v]; j >= 1; --j) {
        if (s[v] == '>') {
          for (int k = i + siz[v]; k >= i + j; --k)
            f[u][k] = inc(f[u][k], (LL)C[k - 1][i - 1] * C[siz[u] + siz[v] - k][siz[u] - i] % P *
                                       g[u][i] % P * f[v][j] % P);
        } else {
          for (int k = i + j - 1; k >= i; --k)
            f[u][k] = inc(f[u][k], (LL)C[k - 1][i - 1] * C[siz[u] + siz[v] - k][siz[u] - i] % P *
                                       g[u][i] % P * f[v][j] % P);
        }
      }
    siz[u] += siz[v];
  }
}

inline int main() {
  cin >> n >> (s + 2);
  for (int i = 0; i <= n; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j) C[i][j] = inc(C[i - 1][j], C[i - 1][j - 1]);
  }
  dfs(1);
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans = inc(ans, f[1][i]);
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3757 [CQOI2017] 老C的键盘.in", "r", stdin);
  freopen("P3757 [CQOI2017] 老C的键盘.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
